package so.wy.servicecenter.businessbed.dao.enums;

/**
 * 设备投放状态
 */
public enum StatusDevicePublishEnum {
    /**
     * 可租赁
     */
    NORMAL(1, "启用"),
    /**
     * 可归还
     */
    STOP(2, "停用");

    private Integer code;
    private String name;

    StatusDevicePublishEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static StatusDevicePublishEnum codeOf(Integer code) {
        if (code == null) {
            return null;
        }

        StatusDevicePublishEnum[] values = values();
        for (StatusDevicePublishEnum value : values) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }

    public static String codeOfDesc(Integer code) {
        StatusDevicePublishEnum value = codeOf(code);

        return value == null ? "" : value.getName();
    }
}